package com.qf.smartdevice.mapper;

import com.qf.smartdevice.pojo.SysCategory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 王博康
 * @version 1.0
 * @project devicemanagementsystem
 * @description: TODO
 * @date 2022/3/20 8:26 星期日
 */
public interface SysCategoryMapper {

    @Select("SELECT * FROM sys_category")
    List<SysCategory> findAll();

    @Select("SELECT * FROM sys_category where c_id=#{id}")
    SysCategory findById(Long id);

    @Insert("insert into sys_Category (category_name,tx_command,rx_command,command_name,create_by,create_time)" +
            "values (#{categoryName},#{txCommand},#{rxCommand},#{commandName},#{createBy},#{createTime})")
    void addCategory(SysCategory sysCategory);

    @Select("select * from sys_category where category_name=#{categoryName}")
    SysCategory findByName(String categoryName);

    int updateCategory(SysCategory sysCategory);

    int deleteByIds(@Param("ids") List<Long> ids);
}
